//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef FLCUSTOM_H
#define FLCUSTOM_H

//#define FL_XSCALE_BOOT_MODE     /* manful */

/* Defines the package to be compiled.
 *
 * Normally the TrueFFS SDK is compiled, but if you want to compile only the 
 * BDK, uncomment the defintion bellow.
 *
 * Note: The BDK requires the MTDSA.H and MTDSA.C files.
 */

/* #define MTD_STANDALONE */

/* Driver & TrueFFS (OSAK) Version numbers */

#define driverVersion   "OS Less 6.1.0.0"
#define OSAKVersion     "6.1.0.0"

#define  ACTIVE_DEBUG_ZONE FLZONE_NONE

/*
 *
 *              Varios Limits Customization
 *              ---------------------------
 */

/* Number of sockets
 *
 * Defines the maximum number of physical drives supported.
 *
 * The actual number of sockets depends on which socket controllers are
 * actually registered and the number of sockets in the system.
 */

#define SOCKETS  1

#define FL_NO_QUICK_MOUNT_FEATURE

/* Number of volumes
 *
 * Defines the maximum number of logical drives supported.
 *
 * The actual number of drives depends on which socket controllers are
 * actually registered, the amount of devices in the system and the
 * TL format of each device.
 */

#define VOLUMES  (4 * SOCKETS)

 /* Number of Binary partitions on the DiskOnChip.
 *
 * Defines Maximum Number of Binary partitions on the DiskOnChip.
 *
 * The actual number of partitions depends on the format placed
 * on each device.
 */

#define BINARY_PARTITIONS (3 * SOCKETS)

/* Maximum MTD's and Translation Layers
 *
 * Define here the maximum number of Memory Technology Drivers (MTD) and
 * Translation Layers (TL) that may be installed. Note that the actual
 * number installed is determined by which components are installed in
 * 'flRegisterComponents' (flcustom.c).
 */

#define FL_MTDS    1       /* Up to 2 MTD's */

#define FL_TLS     1       /* Up to 2 Translation Layers */

/*
 *
 *              FAT-Lite File System Customization
 *              ----------------------------------
 */

/* Number of open files
 *
 * Defines the maximum number of files that can be open at a time.
 */

#define FL_FILES   0

#if FL_FILES > 0

/* Sub-directories
 *
 * Uncomment the following line if you need support for sub-directories
 * using the FAT-FLITE file system.
 */

#define SUB_DIRECTORY

/* Rename file
 *
 * Uncomment the following line if you need to rename files with
 * flRenameFile.
 */

#define RENAME_FILE

/* Split / join file
 *
 * Uncomment the following line if you need to split or join files with
 * flSplitFile and flJoinFile.
 */

#define SPLIT_JOIN_FILE

/* 12-bit FAT support
 *
 * Comment the following line if you do not need support for DOS media with
 * 12-bit FAT (typically media of 8 MBytes or less).
 */

#define FAT_12BIT

/* Parse path function
 *
 * Uncomment the following line if you need to parse DOS-like path names
 * with flParsePath.
 */

#define PARSE_PATH

#endif /* FILES > 0 */

/*
 *
 *              Features Customization
 *              ----------------------
 */

/* 
 * Remove all flash write functionalities ons from the source. 
 */

/* #define FL_READ_ONLY */

/* Formatting
 *
 * Uncomment the following line if you need to format the media.
 */

#define FORMAT_VOLUME

#ifdef FORMAT_VOLUME

/* Number of sectors per FAT cluster
 *
 * Define the minimum cluster size in sectors for the FAT competable format.
 */

#define MIN_CLUSTER_SIZE   4

#endif /* FORMAT_VOLUME */

/* Placing EXB files
 *
 * Uncomment the following line if you need to place M-Systems firmware
 * (DOCxx.EXB file) on the media. The file will install itself as a
 * BIOS extension driver, hooking INT13h to emulate a HD.
 */

/* #define WRITE_EXB_IMAGE */

/* Defragmentation
 *
 * Uncomment the following line if you need to defragment with
 * flDefragmentVolume.
 */

/* #define DEFRAGMENT_VOLUME
 */

/* Absolute read & write
 *
 * Uncomment the following line if you want to be able to read & write
 * sectors by absolute sector number (i.e. without regard to files and
 * directories).
 */

#define ABS_READ_WRITE

/* Environment Variables
 *
 * Enable environment variables control of the TrueFFS features.
 *
 */

#define ENVIRONMENT_VARS

/* IO Controll Interface
 *
 * Support standard IOCTL interface.
 *
 */

/* #define IOCTL_INTERFACE */

 /* Binary Partition
 *
 * Enables access to the Binary partition.
 *
 */

#define BDK_ACCESS  /*comment out by Manful 2004-3-2 */

/* H/W OTP
 *
 * Enable H/W One Time Programing capability including unique ID/
 *
 */

/* #define HW_OTP */

/* H/W Protection
 *
 * Enable H/W protection of the device.
 *
 */

/* #define HW_PROTECTION  */

/* Application exit
 *
 * If the FLite application ever exits, it needs to call flEXit before
 * exiting. Uncomment the following line to enable this.
 */

#define EXIT

/* Disk partition cash
 *
 * Enable Block Device Translation Layer cache.
 *
 * Turning on this option improves performance but requires additional
 * RAM resources.
 *
 * The NAND Flash Translation Layer (NFTL , INFTL and SAFTL) are specifications
 * for storing data on the DiskOnChip in a way that enables accessing the
 * DiskOnChip as a Virtual Block Device. If this option is on, then the BDTL 
 * keeps in RAM a table that saves some of the flash accesses.
 * Whenever it is needed to change table entry, the BDTL updates it in the
 * RAM table and on the DiskOnChip. If the TL has to read table entry, then you
 * can save time on reading sector from DiskOnChip.
 *
 * SAFTL will allocate cache tables regardless of this compilation flag.
 */

//#define FL_TL_CACHE

/* Selects or deselects physical flash access and programming, including read,
 * write, erase. OTP calls, Unique ID calls, inquire capabilities and IPL calls.
 */

#define FL_LOW_LEVEL

/* S/W Write protection
 *
 * Enable S/W write protection of the device.
 *
 */

/* #define WRITE_PROTECTION */

/* Definitions required for write protection. */

#ifdef WRITE_PROTECTION
#define ABS_READ_WRITE
#define SCRAMBLE_KEY_1  647777603l
#define SCRAMBLE_KEY_2  232324057l
#endif

/* Read after write
 *
 * Add read after every write verifing data integrity. Make sure that
 * flVerifyWrite variable is also set to FL_ON.
 *
 */

#define VERIFY_WRITE

/* Verify entire volume
 *
 * Compile the flVerifyVolume routine - this routine scans the entire disk
 * partition for power failures symptoms and correct them.
 *
 */

/* #define VERIFY_VOLUME */

/* Disable the automatic argument check
 *
 * You can remove code and even slightly improve the overall performance by
 * allowing TrueFFS to skip its internal argument check by defining
 *
 */

#define FL_SKIP_ARGS_CHECK

/* Compile the extended Disk information routine
 *
 * TrueFFS 6.0 and up provide an extended information routine for internal
 * M-Systems utilities named flGetExtendedDiskInfo(). 
 * To compile its code define
 */

/* define FL_EXTENEDED_DISK_INFO */

/* Remove IPL code.
 *
 * Removes the IPL code (This applies only to DiskOnChip Millennium Plus 
 * and DiskOnChip 2000 TSOP).
 *
 */

/*#define NO_IPL_CODE*/

/*
 *  Removes the inquire capability code.
 *
 */

/* #define NO_INQUIRE_CAPABILITIES */

/*
 *  Removes read Bad Block Table code. 
 *
 */

/* #define NO_READ_BBT_CODE */

/* Remove code used for binary partition partial page access
 *
 * Due to flash limitations, the binary partition requires special handling 
 * to access (read and write) partial pages. When set this compilation flag
 * will remove the binary partition code and RAM buffers that handle partial
 * page access.
 */

/* #define FL_NO_BDK_PARTIAL_PAGE_ACCESS */

/* Allow TrueFFS to search for a DiskOnChip on address 0.
 *
 * For backwards compatibility reasons, TrueFFS does not allow DiskOnChip to
 * reside at address 0. If this address is given to the TrueFFS DiskOnChip 
 * search routines, it will use the legacy BIOS extension address space.
 * To enable address 0 support, uncomment the definition bellow.
 */

#define FL_ADD_ADDRESS_0_SUPPORT

/*
 *
 *              Static Allocation Defenitions
 *              -----------------------------
 */

/*
 * These defines are used for the static memory allocation configuration
 * of the driver. If your TrueFFS based application or driver are using
 * dynamic allocation you should not customize any of the definitions bellow
 */

/* Maximum supported medium size.
 *
 * Define here the largest Flash medium size (in MBytes) you want supported.
 * This define also sets the size of the TrueFFS variable used for storeing the
 * number of sectors in the meida. Therefore this variable should be larger 
 * then 32.
 *
 */

#define FL_ASSUMED_MAX_VOLUME_MBYTES       128L

/* NAND minimal flash block */
#define FL_ASSUMED_MIN_UNIT_SIZE           0x10000L         /* Minimal unit size */

#define MAX_LOGICAL_UNITS_IN_PLATFORM (((FLDword)FL_ASSUMED_MAX_VOLUME_MBYTES<<20L) / FL_ASSUMED_MIN_UNIT_SIZE)

/* NAND maximum number of sectors per block
 * Usually this value is equal to FL_ASSUMED_MIN_UNIT_SIZE divided by 512,
 * but if you need to support several DiskOnChip devices then while 
 * FL_ASSUMED_MIN_UNIT_SIZE indicates the smalles unit size, this value
 * indicates the largest number of sectors that can be fitted into a unit
 */
#define FL_ASSUMED_MAX_SECTORS_PER_UNIT    (FL_ASSUMED_MIN_UNIT_SIZE>>9) /* Divided by 512 bytes */

/* The number of cached units (only for SAFTL)
 *
 * This value is ignored if both dynaimc allocation (FL_MALLOC) and 
 * environment variables are enabled (ENVIRONMENT_VARS). If either modes
 * is disabled this flag will set the cache size.
 */

/* #define FL_NUMBER_OF_CACHED_UNITS 0x40L */

/* Fixed or removable media
 *
 * If your Flash media is fixed, uncomment the following line.
 */

#define FIXED_MEDIA

/* Interval timer
 *
 * The following defines a timer polling interval in milliseconds. If the
 * value is 0, an interval timer is not installed.
 *
 * If you select an interval timer, you should provide an implementation
 * for 'flInstallTimer' defined in flsysfun.h.
 *
 * An interval timer is not a must, but it is recommended. The following
 * will occur if an interval timer is absent:
 *
 * - Card changes can be recognized only if socket hardware detects them.
 * - The Vpp delayed turn-off procedure is not applied. This may downgrade
 *   write performance significantly if the Vpp switching time is slow.
 * - The watchdog timer that guards against certain operations being stuck
 *   indefinitely will not be active.
 */

/* Polling interval in millisec. If 0, no polling is done */

#define POLLING_INTERVAL 0

#endif /* FLCUSTOM_H */
